﻿using System.Windows;
using GalaSoft.MvvmLight.Messaging;
using MetroGTD.View;
using MetroGTD.ViewModel;

namespace MetroGTD
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            Messenger.Default.Register<DialogMessage>(this, "AddTask", ShowAddTask);
        }

        void ShowAddTask(DialogMessage obj)
        {
            var addTaskDialog = new AddThing(obj.Sender as IAddTaskViewModel);
            var result = addTaskDialog.ShowDialog();
            result = result ?? false;
            obj.Callback(result.Value ? MessageBoxResult.OK : MessageBoxResult.Cancel);
        }
    }
}
